// 引入mongoose接口
const mongoose = require("mongoose");
const {secondKill} = require ("./data/secondKill.js");

//初始化model
const schema = new mongoose.Schema({
    CommId:Number,
    Sale:Number,
    Time:Date,
})

const secondKillModel=mongoose.model("secondKill",schema,"secondKill");

mongoose.connect(
    // 数据库地址
    "mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/heshumiao_project3",
    {
        useNewUrlParser: true,
        useUnifiedTopology: true,
        auth: { authSource: "admin" }
    },
   async () => {
     await secondKillModel.create(secondKill);

   }
);

module.exports={secondKillModel};

